﻿<%@ Page Title="" Language="C#" MasterPageFile="~/EasyUI.Master" AutoEventWireup="true" CodeBehind="Listmy.aspx.cs" Inherits="cebao.Web.bzinfo.Listmy" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            bztree();
        });
     function bztree() {
            $('#bzph').panel({
                height: '100%',
                title: '孢子信息'

            });
            $('#bzth').tree({
                url: '../bzinfo/GetBZ.ashx', //请求数据的页面 
                lines: true,
                method: 'post',
                queryParams: { "action": "queryone" },                
                formatter: function (node) {
                    return node.text + "(" + node.lvalue + "-" + node.hvalue + ")";
                }
            });
            $('#mybz').panel({
                height: '100%',
                title: '本地孢子信息'

            });
            $('#mybzth').tree({
                url: '../bzinfo/GetBZ.ashx', //请求数据的页面
                lines: true,
                method: 'post',
                queryParams: { "action": "querymy" },
                formatter: function (node) {
                    return node.text + "(" + node.lvalue + "-" + node.hvalue + ")";
                }
            });
        }
        function newNodebz() {
            $('#fmbz').form('clear');
            var node = $('#bzth').tree('getSelected');
            if (node != null) {
                //$('#parentidh').val(node.id);
                $('#fmbz').form('submit', {
                    url: "../bzinfo/GetBZ.ashx?action=addmy&bzid=" + node.id,
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgbz').dialog('close');
                            $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                            $('#mybzth').tree('reload');
                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "添加失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/index.aspx';
                            return;
                        }
                    }
                });
            }
            else {
                $.messager.alert("提示", "请选择要设置的数据！", "info");

            }

        }
        function removeUserbz() {
            var row = $('#mybzth').tree('getSelected');
            if (row == null) {
                $.messager.alert("提示", "请选择要删除的数据！", "info");
            }
            if (row) {
                $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
                    if (r) {
                        $('#fmbz').form('submit', {
                            url: '../bzinfo/GetBZ.ashx?mbzid=' + row.id + "&action=deletemy",
                            onSubmit: function () {
                            },
                            success: function (result) {
                                if (result.indexOf("T") == 0) {
                                    $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                                    $('#mybzth').tree('reload');
                                }
                                else {
                                    $.messager.alert("提示", "删除失败，请重新操作！", "info");
                                    return;
                                }
                            }
                        });
                    }
                })

            }
        }
        </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="easyui-layout mycon" style="width: 100%; height: 100%;">
                        <div region="west" split="true" class="myh" style="width: 300px; overflow: auto">
                            <div id="bzph" class="easyui-panel" data-options="iconCls:'icon-save',tools:'#tab_toolbarbz'" style="overflow: auto;">
                                <ul id="bzth"></ul>
                            </div>
                        </div>
                        <div region="center" class="myh" style="background: #eee; overflow: auto">
                            <div id="mybz" class="easyui-panel" data-options="iconCls:'icon-save',tools:'#tab_toolbar2bz'" style="overflow: auto;">
                                <ul id="mybzth"></ul>
                            </div>
                        </div>
                    </div>
    <div id="tab_toolbarbz">
        <a href="#" onclick="newNodebz();" id="a_addh" class="icon-add" style="margin-right: 10px"></a>

    </div>
    <div id="tab_toolbar2bz">
        <a href="#" onclick="removeUserbz();return false;" id="a6" class="icon-cancel" style="margin-right: 10px"></a>
    </div>
    <div id="dlgbz" class="easyui-dialog" style="width: 350px; height: auto; padding: 10px 20px"
        data-options="closed:true,shadow:false">
        <form id="fmbz" method="post">
        </form>
    </div>
</asp:Content>
